package com.example.s202404025;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RequestMapping("d1")
@RestController
public class Demo1 {
//    @RequestMapping("r1")
//    public String method_1(@RequestParam(value = "time") String newTime) {
//        return "接收到的参数newTime：" + newTime;
//    }
    @RequestMapping("r1")
    public String method_1(@RequestParam(value = "time",required = false) String newTime) {
        return "接收到的参数newTime：" + newTime;
    }

    @RequestMapping("r2")
    public String method2(String[] str) {
        return Arrays.toString(str);
    }

    @RequestMapping("r3")
    public String method3(@RequestParam List<String> list) {
        return "size:" + list.size() + ",list:" + list;
    }
}